﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public static class ArrayEx
    {
        public static Boolean Equivalent<T>(this T[] ary1, T[] ary2)
        {
            Boolean equiv = (ary1 == ary2);

            if (!equiv && ary1 != null && ary2 != null)
            {
                if (ary1.Length == ary2.Length)
                {
                    equiv = true;

                    for (Int32 i = 0; equiv && i < ary1.Length; i++)
                    {
                        if (!Object.Equals(ary1[i], ary2[i]))
                        {
                            equiv = false;
                        }
                    }
                }
            }

            return equiv;
        }
    }
}
